﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcWeb.Models;
using System.Web.Security;
using SailHero.Soft.FrameWork.Models;
using UI.Web.SailHeroSoftAuthorization.Helper;

namespace MvcWeb.Controllers
{
    public class BaseController : Controller
    {

        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {

            HttpContextBase ctx = filterContext.HttpContext;
            if (Session["user"] == null)
            {
                ctx.Response.Redirect("~/Login/Login");
            }
            base.OnActionExecuting(filterContext);
        }

        public SYS_USER LoginUser
        {
            get
            {
                if (Session["user"] == null)
                {
                    FormsAuthentication.SignOut();
                }
                return Session["user"] as SYS_USER;
            }
        }
    }
}